/*
 * @lc app=leetcode.cn id=283 lang=javascript
 *
 * [283] 移动零
 */

// @lc code=start
/**
 * @param {number[]} nums
 * @return {void} Do not return anything, modify nums in-place instead.
 */
var moveZeroes = function(nums) {
  let count=0
  let len=nums.length
  for(let i=0;i<nums.length;i++){
    if(count)nums[i-count]=nums[i]
      if(nums[i]==0){
          count++
      }
      
  }
//   nums.length=len
  for(let i=0;i<count;i++){
    nums[len-i-1]=0
  }
  return nums
};
// @lc code=end
moveZeroes([1,2,3,0,0,1])
